/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Anali
 */
@Entity
@Table(name = "modulo")
@NamedQueries({
    @NamedQuery(name = "Modulo.findAll", query = "SELECT m FROM Modulo m"),
    @NamedQuery(name = "Modulo.findByIdModulo", query = "SELECT m FROM Modulo m WHERE m.idModulo = :idModulo"),
    @NamedQuery(name = "Modulo.findByNombreModulo", query = "SELECT m FROM Modulo m WHERE m.nombreModulo = :nombreModulo"),
    @NamedQuery(name = "Modulo.findByFechaFin", query = "SELECT m FROM Modulo m WHERE m.fechaFin = :fechaFin")})
public class Modulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idModulo")
    private Integer idModulo;
    @Basic(optional = false)
    @Column(name = "nombreModulo")
    private String nombreModulo;
    @Column(name = "fechaFin")
    private String fechaFin;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "modulo")
    private Collection<Rolmodulo> rolmoduloCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "modulo")
    private Collection<Rolareamodulo> rolareamoduloCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "modulo")
    private Collection<Submodulo> submoduloCollection;

    public Modulo() {
    }

    public Modulo(Integer idModulo) {
        this.idModulo = idModulo;
    }

    public Modulo(Integer idModulo, String nombreModulo) {
        this.idModulo = idModulo;
        this.nombreModulo = nombreModulo;
    }

    public Integer getIdModulo() {
        return idModulo;
    }

    public void setIdModulo(Integer idModulo) {
        this.idModulo = idModulo;
    }

    public String getNombreModulo() {
        return nombreModulo;
    }

    public void setNombreModulo(String nombreModulo) {
        this.nombreModulo = nombreModulo;
    }

    public String getFechaFin() {
        return fechaFin;
    }

    public void setFechaFin(String fechaFin) {
        this.fechaFin = fechaFin;
    }

    public Collection<Rolmodulo> getRolmoduloCollection() {
        return rolmoduloCollection;
    }

    public void setRolmoduloCollection(Collection<Rolmodulo> rolmoduloCollection) {
        this.rolmoduloCollection = rolmoduloCollection;
    }

    public Collection<Rolareamodulo> getRolareamoduloCollection() {
        return rolareamoduloCollection;
    }

    public void setRolareamoduloCollection(Collection<Rolareamodulo> rolareamoduloCollection) {
        this.rolareamoduloCollection = rolareamoduloCollection;
    }

    public Collection<Submodulo> getSubmoduloCollection() {
        return submoduloCollection;
    }

    public void setSubmoduloCollection(Collection<Submodulo> submoduloCollection) {
        this.submoduloCollection = submoduloCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idModulo != null ? idModulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Modulo)) {
            return false;
        }
        Modulo other = (Modulo) object;
        if ((this.idModulo == null && other.idModulo != null) || (this.idModulo != null && !this.idModulo.equals(other.idModulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Modulo[idModulo=" + idModulo + "]";
    }

}
